package com.yinhe.module.yzx.tool;

import com.yinhe.common.utils.DateUtils;
/*import javafx.application.Application;
import javafx.stage.Stage;*/

import java.util.Date;

public class tool extends DateUtils {

    public static int differentDay(Date date1, Date date2)
    {
        return (int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24));
    }
    public static String getDatePoora(Date endDate, Date nowDate)
    {
        long nd = 1000 * 24 * 60 * 60;
        long nh = 1000 * 60 * 60;
        long nm = 1000 * 60;
        // long ns = 1000;
        // 获得两个时间的毫秒时间差异
        long diff = endDate.getTime() - nowDate.getTime();
        // 计算差多少天
        long day = diff / nd;
        // 计算差多少小时
        long hour = diff % nd / nh;
        // 计算差多少分钟
        long min = diff % nd % nh / nm;
        // 计算差多少秒//输出结果
        // long sec = diff % nd % nh % nm / ns;
        long dh=day*24+hour;
        if (dh>999)
        {
            dh=999;
        }

        String str = String.format("%03d", dh);
        String str1 = String.format("%02d", min);
        System.out.println(str+"+"+str1);
        return str+str1 ;
    }
    public static String autoGenericCode(String code, int num) {
        String result1 = "";

        result1 = String.format("%0" + num + "d", Integer.parseInt(code));

        return result1;}

}
